x=int(input())

for i in range(x+1):
    if (i*i)%391==13:
        print(i)